package com.ape.mapsa.produccion.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the maquina_asig database table.
 * 
 */
@Entity
@Table(name = "extrusion")
public class Extrusion implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "fecha_fin")
	private Date fechaFin;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "fecha_inicio")
	private Date fechaInicio;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creation_date")
	private Date creationDate;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modification_date")
	private Date modificationDate;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "finalization_date")
	private Date finalizationDate;

	@Column(name = "created_by")
	private String createdBy;
	@Column(name = "modified_by")
	private String modifiedBy;

	// bi-directional many-to-one association to ExtPerformedWork
	@OneToMany(mappedBy = "extrusion")
	private List<ExtPerformedWork> extPerformedWorks;

	// bi-directional many-to-one association to ExtProdScrap
	@OneToMany(mappedBy = "extrusion")
	private List<ExtProdScrap> extProdScraps;

	// bi-directional many-to-one association to OrdenProduccion
	@OneToOne
	@JoinColumn(name = "orden_produccion_id")
	private OrdenProduccion ordenProduccion;

	// bi-directional many-to-one association to Maquina
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "maquina")
	private Maquina maquina;

	@Column(name = "gr_m_cuadrado")
	private Float grm2;

	private Float gramaje;

	@Column(name = "peso_bolsa")
	private Float pesoBolsa;

	private Float metros;
	private Integer bobinas;
	private Float kilos;

	@Column(name = "total_bobinas")
	private Integer totalBobinas;

	@Column(name = "total_kilos")
	private Float totalKilos;

	@Column(name = "total_mts")
	private Float totalMts;

	@Column(name = "total_scrap")
	private Float totalScrap;

	public Extrusion() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getFechaFin() {
		return this.fechaFin;
	}

	public void setFechaFin(Date fechaFin) {
		this.fechaFin = fechaFin;
	}

	public Date getFechaInicio() {
		return this.fechaInicio;
	}

	public void setFechaInicio(Date fechaInicio) {
		this.fechaInicio = fechaInicio;
	}

	public OrdenProduccion getOrdenProduccion() {
		return this.ordenProduccion;
	}

	public void setOrdenProduccion(OrdenProduccion ordenProduccion) {
		this.ordenProduccion = ordenProduccion;
	}

	public Maquina getMaquina() {
		return this.maquina;
	}

	public void setMaquina(Maquina maquina) {
		this.maquina = maquina;
	}

	public Float getGrm2() {
		return grm2;
	}

	public void setGrm2(Float grm2) {
		this.grm2 = grm2;
	}

	public Float getGramaje() {
		return gramaje;
	}

	public void setGramaje(Float gramaje) {
		this.gramaje = gramaje;
	}

	public Float getPesoBolsa() {
		return pesoBolsa;
	}

	public void setPesoBolsa(Float pesoBolsa) {
		this.pesoBolsa = pesoBolsa;
	}

	public Float getMetros() {
		return metros;
	}

	public void setMetros(Float metros) {
		this.kilos = grm2 * metros / 1000;
		this.metros = metros;
	}

	public Integer getBobinas() {
		return bobinas;
	}

	public void setBobinas(Integer bobinas) {
		this.bobinas = bobinas;
	}

	public Float getKilos() {
		return kilos;
	}

	public void setKilos(Float kilos) {
		this.kilos = kilos;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getModificationDate() {
		return modificationDate;
	}

	public void setModificationDate(Date modificationDate) {
		this.modificationDate = modificationDate;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getModifiedBy() {
		return modifiedBy;
	}

	public void setModifiedBy(String modifiedBy) {
		this.modifiedBy = modifiedBy;
	}

	public List<ExtPerformedWork> getExtPerformedWorks() {
		return extPerformedWorks;
	}

	public void setExtPerformedWorks(List<ExtPerformedWork> extPerformedWorks) {
		this.extPerformedWorks = extPerformedWorks;
	}

	public List<ExtProdScrap> getExtProdScraps() {
		return extProdScraps;
	}

	public void setExtProdScraps(List<ExtProdScrap> extProdScraps) {
		this.extProdScraps = extProdScraps;
	}

	public Integer getTotalBobinas() {
		return totalBobinas;
	}

	public void setTotalBobinas(Integer totalBobinas) {
		this.totalBobinas = totalBobinas;
	}

	public Float getTotalKilos() {
		return totalKilos;
	}

	public void setTotalKilos(Float totalKilos) {
		this.totalKilos = totalKilos;
	}

	public Float getTotalMts() {
		return totalMts;
	}

	public void setTotalMts(Float totalMts) {
		this.totalMts = totalMts;
	}

	public Float getTotalScrap() {
		return totalScrap;
	}

	public void setTotalScrap(Float totalScrap) {
		this.totalScrap = totalScrap;
	}

	public Date getFinalizationDate() {
		return finalizationDate;
	}

	public void setFinalizationDate(Date finalizationDate) {
		this.finalizationDate = finalizationDate;
	}

	@Override
	public String toString() {
		return "Extrusion [id=" + id + ", fechaFin=" + fechaFin + ", fechaInicio=" + fechaInicio + ", ordenProduccion=" + ", maquina=" + maquina
				+ ", grm2=" + grm2 + ", gramaje=" + gramaje + ", pesoBolsa=" + pesoBolsa + ", metros=" + metros + ", bobinas=" + bobinas + ", kilos="
				+ kilos + "]";
	}

}